package lab02.test06;

import static java.lang.StrictMath.sqrt;

public class Triangle {
    //定义三角形的三边为double型
    private double a;
    private double b;
    private double c;

    //无参的构造方法
    Triangle(){};
    //有参的构造方法
    Triangle(double a,double b,double c){
        this.a = a;
        this.b = b;
        this.c = c;
    }
    //求周长
    double girtf(){
            return a + b + c;
    }
    //求面积
    double area(){
        double s= (a + b + c) / 2;
        return  sqrt(s *(s - a) * (s - b) * (s - c));
    }
    //修改边长
    void revise(double a,double b,double c){
        this.a = a;
        this.b = b;
        this.c = c;
    }
    //判断能否构成三角形
    boolean judge(){
        if((a + b > c ) && (Math.abs(a - b) )< c){
            return true;
        }else
            return false;
    }
}
